﻿@{
    ViewBag.Title = "预览数据质量表数据";
    Layout = "~/Views/Shared/_Main.cshtml";
}
@section Head{
    <style>
        .tb1
        {
            width: 160px;
            border: 1px;
            background: #99BBE8;
            line-height: 25px;
            font-weight: bold;
            color: #ffffff;
            padding-left: 10px;
            cursor: pointer;
        }
        .tb2
        {
            width: 160px;
            border: 1px;
            background: #eee;
            line-height: 25px;
            padding-left: 10px;
            cursor: pointer;
        }
        .pagTable td
        {
            padding-left: 3px;
        }
        #ViewSreach
        {
            display: none;
            width: 650px;
            height: 200px;
            position: absolute;
            top: 35px;
            left: 100px;
            z-index: 1002;
        }
        .viewData
        {
            display: none;
        }
        #sarea
        {
            background-color: #ffffff;
            border: #ccc 1px solid;
            height: 300px;
            overflow-y: scroll;
        }
    </style>
    <script type="text/javascript">
        var UrlArray = $.getUrlArray();
        $(function () {
            initSourceTableData();
        });
        var shead = true;
        var query;
        function initSourceTableData(sortField, sortBy) {
            $(".loading").show();
            $.ajax({
                type: "POST",
                url: "/GenericSearch/GetTableData/",
                data: { modelID: UrlArray["modelID"], DQID: UrlArray["DQID"], dbName: encodeURI(UrlArray["dbName"]), order: sortField, sort: sortBy, query: query },
                datatype: "text/plain",
                async: true,
                success: function (result) {
                    if (result.Success) {
                        $("#divSoutceTableData").html(result.Data);
                        if (shead) {
                            $("#sarea").html(result.Head);
                            shead = false;
                        }
                    }
                    else {
                        $("#msg").html(result.Message);
                    }
                    $(".loading").hide();
                }
            });
        }
        function sreach() {
            var sr = [];
            $("#sarea tr").each(function (i, d) {
                var nm = d.id;
                if ($(".sel_" + nm).val() == "" || $.trim($(".txt_" + nm).val()) == "") return;
                var arr = new Array();
                arr.push(nm);
                arr.push($(".sel_" + nm).val());
                arr.push($.trim($(".txt_" + nm).val()));
                sr.push(arr);
            });
            $('#ViewSreach').hide(); $('#DIVMask').hide();
            query = $.toJSON(sr);
            initSourceTableData("", "");
        }
    </script>
}
<div style="margin: 5px; height: 400px;">
    <table class="listTitle">
        <tbody>
            <tr>
                <td width="15">
                    <img src="/images/filesave.png">
                </td>
                <td width="300">
                    预览数据质量表数据
                </td>
                <td align="right">
                    <input type="button" class="button" value="搜索" onclick="$('#ViewSreach').show();$('#DIVMask').show();" />
                </td>
            </tr>
        </tbody>
    </table>
    <div id="tab2" style="width: 790px; height: 350px; overflow: scroll;">
        <div id="divSoutceTableData">
            <div id="loading" class="loading">
                <img src="/Images/tree_loading.gif" />
            </div>
        </div>
        <div id="msg">
        </div>
    </div>
</div>
<div id="ViewSreach">
    <table class="listTitle">
        <tbody>
            <tr>
                <td width="15">
                    <img src="/images/search.png">
                </td>
                <td width="260">
                    预览数据质量表数据
                </td>
                <td align="right">
                    <input type="button" class="button" value="提交" onclick="sreach();" />
                    <input type="button" class="button" value="关闭" onclick="$('#ViewSreach').hide();$('#DIVMask').hide();" />
                </td>
            </tr>
        </tbody>
    </table>
    <div id="sarea">
    </div>
</div>
<div id="DIVMask">
</div>
